#include "link_pub.h"

typedef struct {
    char name[50];
    int credit;
    int hours;
    int studentCount;
    char students[MAX_STUDENTS][50];
} Course;

Course courses[MAX_COURSES];
int courseCount = 0;

typedef struct {
    char stu_id[15];
    char stu_name[15];
    char stu_CourseList[10][20];
    int count;
    int total;
} Student;

Student students[MAX_STUDENTS];
int numStudents = 0;

extern void ter();

extern Course creatcourse_ter();

extern void addCourse_ter();

extern int find_ter(char *name);

extern void deleteCourse_ter(char *name);

extern void printcourse_ter(int x);

extern void showCourse_ter(char *name);

extern void updateCourse_ter(char *name);

extern void displayCourseInfo_ter();

extern void course_ter();

extern void student_ter();

extern void print_ter(int x);

extern Student creatstudent_ter();

extern void byname_ter(int flag);

extern void bynumber_ter(int flag);

extern void modify_search_ter(int x,int flag);

extern void addStudent_ter(); 

extern void displayStudents_ter();

extern void deleteStudent_ter();

extern void searchStudent_ter();

extern void modifyStudent_ter();



extern void file();

extern Course creatcourse_file();

extern void addCourse_file();

extern int find_file(char *name);

extern void deleteCourse_file(char *name);

extern void printcourse_file(int x);

extern void showCourse_file(char *name);

extern void updateCourse_file(char *name);

extern void displayCourseInfo_file();

extern void course_file();

extern void student_file();

extern void print_file_student_file(int x,FILE *output_file_student);

extern void print_ter_file(int x);

extern Student creatstudent_file(int flag,FILE *input_file_student);

extern void byname_file(int flag);

extern void bynumber_file(int flag);

extern void modify_search_file(int x,int flag);

extern void addStudent_file(); 

extern void displayStudents_file();

extern void deleteStudent_file();

extern void searchStudent_file();

extern void modifyStudent_file();

int main(){
	int choice;
    do {
        printf("请选择录入模式\n");
        printf("1. 从文件读入\n");
        printf("2. 从控制台输入\n");
        printf("3. 退出\n");
        printf("输入你的选择: ");
        scanf("%d", &choice);
		
        switch (choice) {
            case 1:
                file();
                break;
            case 2:
                ter();
                break;
            case 3:
                printf("退出程序.\n");
                return 0;
            default:
                printf("无效的选择，请重试。\n");
        }

        printf("\n");
    } while (1);
}
